<?php class Personalities { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $name;

    /***
     * DB Fields: bonusDamage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusDamage;

    /***
     * DB Fields: bonusDefense
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusDefense;

    /***
     * DB Fields: bonusExpBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusExpBattle;

    /***
     * DB Fields: bonusExpBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusExpBuilding;

    /***
     * DB Fields: bonusExpResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusExpResearch;

    /***
     * DB Fields: bonusExpMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusExpMinning;

    /***
     * DB Fields: bonusMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusMinning;

    /***
     * DB Fields: bonusBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusBuilding;

    /***
     * DB Fields: bonusResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusResearch;

    /***
     * DB Fields: bonusPopulation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $bonusPopulation;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result name
     **/
    function get_name( ) {
        // returns the value of name
        return $this->name;
    }


    /***
     * Get value for field: bonusDamage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusDamage
     **/
    function get_bonusDamage( ) {
        // returns the value of bonusDamage
        return $this->bonusDamage;
    }


    /***
     * Get value for field: bonusDefense
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusDefense
     **/
    function get_bonusDefense( ) {
        // returns the value of bonusDefense
        return $this->bonusDefense;
    }


    /***
     * Get value for field: bonusExpBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusExpBattle
     **/
    function get_bonusExpBattle( ) {
        // returns the value of bonusExpBattle
        return $this->bonusExpBattle;
    }


    /***
     * Get value for field: bonusExpBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusExpBuilding
     **/
    function get_bonusExpBuilding( ) {
        // returns the value of bonusExpBuilding
        return $this->bonusExpBuilding;
    }


    /***
     * Get value for field: bonusExpResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusExpResearch
     **/
    function get_bonusExpResearch( ) {
        // returns the value of bonusExpResearch
        return $this->bonusExpResearch;
    }


    /***
     * Get value for field: bonusExpMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusExpMinning
     **/
    function get_bonusExpMinning( ) {
        // returns the value of bonusExpMinning
        return $this->bonusExpMinning;
    }


    /***
     * Get value for field: bonusMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusMinning
     **/
    function get_bonusMinning( ) {
        // returns the value of bonusMinning
        return $this->bonusMinning;
    }


    /***
     * Get value for field: bonusBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusBuilding
     **/
    function get_bonusBuilding( ) {
        // returns the value of bonusBuilding
        return $this->bonusBuilding;
    }


    /***
     * Get value for field: bonusResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusResearch
     **/
    function get_bonusResearch( ) {
        // returns the value of bonusResearch
        return $this->bonusResearch;
    }


    /***
     * Get value for field: bonusPopulation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result bonusPopulation
     **/
    function get_bonusPopulation( ) {
        // returns the value of bonusPopulation
        return $this->bonusPopulation;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param name
     * @result void
     **/
    function set_name( $name ) {
        // sets the value of name
        $this->name = $name;
    }

    /***
     * Set value for field: bonusDamage
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusDamage
     * @result void
     **/
    function set_bonusDamage( $bonusDamage ) {
        // sets the value of bonusDamage
        $this->bonusDamage = $bonusDamage;
    }

    /***
     * Set value for field: bonusDefense
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusDefense
     * @result void
     **/
    function set_bonusDefense( $bonusDefense ) {
        // sets the value of bonusDefense
        $this->bonusDefense = $bonusDefense;
    }

    /***
     * Set value for field: bonusExpBattle
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusExpBattle
     * @result void
     **/
    function set_bonusExpBattle( $bonusExpBattle ) {
        // sets the value of bonusExpBattle
        $this->bonusExpBattle = $bonusExpBattle;
    }

    /***
     * Set value for field: bonusExpBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusExpBuilding
     * @result void
     **/
    function set_bonusExpBuilding( $bonusExpBuilding ) {
        // sets the value of bonusExpBuilding
        $this->bonusExpBuilding = $bonusExpBuilding;
    }

    /***
     * Set value for field: bonusExpResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusExpResearch
     * @result void
     **/
    function set_bonusExpResearch( $bonusExpResearch ) {
        // sets the value of bonusExpResearch
        $this->bonusExpResearch = $bonusExpResearch;
    }

    /***
     * Set value for field: bonusExpMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusExpMinning
     * @result void
     **/
    function set_bonusExpMinning( $bonusExpMinning ) {
        // sets the value of bonusExpMinning
        $this->bonusExpMinning = $bonusExpMinning;
    }

    /***
     * Set value for field: bonusMinning
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusMinning
     * @result void
     **/
    function set_bonusMinning( $bonusMinning ) {
        // sets the value of bonusMinning
        $this->bonusMinning = $bonusMinning;
    }

    /***
     * Set value for field: bonusBuilding
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusBuilding
     * @result void
     **/
    function set_bonusBuilding( $bonusBuilding ) {
        // sets the value of bonusBuilding
        $this->bonusBuilding = $bonusBuilding;
    }

    /***
     * Set value for field: bonusResearch
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusResearch
     * @result void
     **/
    function set_bonusResearch( $bonusResearch ) {
        // sets the value of bonusResearch
        $this->bonusResearch = $bonusResearch;
    }

    /***
     * Set value for field: bonusPopulation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param bonusPopulation
     * @result void
     **/
    function set_bonusPopulation( $bonusPopulation ) {
        // sets the value of bonusPopulation
        $this->bonusPopulation = $bonusPopulation;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: personalities
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param name
     * @param bonusDamage
     * @param bonusDefense
     * @param bonusExpBattle
     * @param bonusExpBuilding
     * @param bonusExpResearch
     * @param bonusExpMinning
     * @param bonusMinning
     * @param bonusBuilding
     * @param bonusResearch
     * @param bonusPopulation
     * @result void
     **/
    function createnew_personalities( $id, $name, $bonusDamage, $bonusDefense, $bonusExpBattle, $bonusExpBuilding, $bonusExpResearch, $bonusExpMinning, $bonusMinning, $bonusBuilding, $bonusResearch, $bonusPopulation ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $name,
                      $bonusDamage,
                      $bonusDefense,
                      $bonusExpBattle,
                      $bonusExpBuilding,
                      $bonusExpResearch,
                      $bonusExpMinning,
                      $bonusMinning,
                      $bonusBuilding,
                      $bonusResearch,
                      $bonusPopulation); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("personalities", $_obj);
    }

    /***
     * Retrived an existing record: personalities
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Personalities
     **/
    function get_personalities( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM personalities WHERE id = '$id'");

        $__personalitiesObj = new personalities();
        // return the retrived from the database

        // create a new object
        $__obj = new Personalities();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_name($_resultSet[0]['name']);
        $__obj->set_bonusDamage($_resultSet[0]['bonusDamage']);
        $__obj->set_bonusDefense($_resultSet[0]['bonusDefense']);
        $__obj->set_bonusExpBattle($_resultSet[0]['bonusExpBattle']);
        $__obj->set_bonusExpBuilding($_resultSet[0]['bonusExpBuilding']);
        $__obj->set_bonusExpResearch($_resultSet[0]['bonusExpResearch']);
        $__obj->set_bonusExpMinning($_resultSet[0]['bonusExpMinning']);
        $__obj->set_bonusMinning($_resultSet[0]['bonusMinning']);
        $__obj->set_bonusBuilding($_resultSet[0]['bonusBuilding']);
        $__obj->set_bonusResearch($_resultSet[0]['bonusResearch']);
        $__obj->set_bonusPopulation($_resultSet[0]['bonusPopulation']);


        return $__obj;
    }

    /***
     * Update an existing record: personalities
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_personalities( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("personalities", "id = '$id'");
    }

    /***
     * Delete an existing record: personalities
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_personalities( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("personalities", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: personalities
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Personalities
     **/
    function list_personalities( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM personalities WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM personalities";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Personalities();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_name($__rs['name']);
            $__newObj->set_bonusDamage($__rs['bonusDamage']);
            $__newObj->set_bonusDefense($__rs['bonusDefense']);
            $__newObj->set_bonusExpBattle($__rs['bonusExpBattle']);
            $__newObj->set_bonusExpBuilding($__rs['bonusExpBuilding']);
            $__newObj->set_bonusExpResearch($__rs['bonusExpResearch']);
            $__newObj->set_bonusExpMinning($__rs['bonusExpMinning']);
            $__newObj->set_bonusMinning($__rs['bonusMinning']);
            $__newObj->set_bonusBuilding($__rs['bonusBuilding']);
            $__newObj->set_bonusResearch($__rs['bonusResearch']);
            $__newObj->set_bonusPopulation($__rs['bonusPopulation']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>